import store from '@/store'
import { checkPermissionRole } from '@/api/all'
import { Message } from 'element-ui'

/**
 * @param {Array} value
 * @returns {Boolean}
 * @example see @/views/permission/directive.vue
 */
export default function checkPermission(value) {
  return new Promise((resolve, reject) => {
    checkPermissionRole({resources: value}).then(res => {
      const { data } = res
      // if(data.data != true) {
      //   Message.error('没有权限');
      //   return data.data
      // }
      resolve(data.data)
      return data.data
    }).catch((error) => {
      reject(error)
    })
  })
}
